home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / swindows.zip / INPUT.DOC < prev    next >
Text File  |  1990-04-10  |  5KB  |  103 lines

  1.                                    INPUT.TPU
  2.                     The Screen Input Unit for Turbo Pascal
  3.                              by David C. Swaim II
  4.  
  5.  
  6.           INPUT.TPU  is  a  Turbo Pascal Unit designed for data input using
  7.     screen input  fields  with  user  (programmer)  defined  locations  and
  8.     widths.  The unit consists of three Pascal procedures which can be used
  9.     independently.   The  first  two are very simple procedures for turning
  10.     the cursor on and off.  CursorOn turns  the  cursor  on  and  CursorOff
  11.     turns  it  off.  These procedures have no parameters passed to them  so
  12.     they are called by:
  13.  
  14.           CursorOn;
  15.  
  16.     or
  17.  
  18.           CursorOff;
  19.  
  20.           The  main  routine in this unit is called GetIn.  This routine is
  21.     defined by:
  22.  
  23.     Procedure GetIn(    Numin:     Boolean;
  24.                         Maxin,x,y: Integer;
  25.                     var Indata:    InputString;
  26.                     var Insrt:     Boolean;
  27.                     var Control:   Char;
  28.                     var Number:    Real);
  29.  
  30.     Where:
  31.                     Numin = True means the field is for numeric data input,
  32.                             False means text string input.
  33.  
  34.                     Maxin = The character width of the input  field.   This
  35.                             is the maximum number of characters that can be
  36.                             typed  into the input field.  When this maximum
  37.                             is reached the input is terminated just like it
  38.                             is when the Enter key is pressed.
  39.  
  40.                     x,y   = The x and y location on the screen of the input
  41.                             field.   This is the same as used in the GotoXY
  42.                             procedure.
  43.  
  44.                    Indata = This is the input data string.   You  may  load
  45.                             this   string  with  data  before  calling  the
  46.                             procedure.  This allows having a default  input
  47.                             placed in the field.  The input string will  be
  48.                             returned  in Indata. Indata is declared as data
  49.                             type InputString:
  50.  
  51.                             type
  52.                                InputString = String[255];
  53.  
  54.                             This type is declared in the interface  section
  55.                             of the unit and does not need to be declared in
  56.                             your program.
  57.  
  58.                     Insrt = True means that anything typed will be inserted
  59.                             in   the   input  data  string  at  the  cursor
  60.                             location.   False  means  anything  typed  will
  61.                             replace   whatever  is  already  in  the  input
  62.                             string  at  the  cursor  location. Insrt may be
  63.                             set  to  True  or False before calling GetIn or
  64.                             it can be toggled on and  off  by  hitting  the
  65.                             Ins key while inputting.
  66.  
  67.                   Control = This is a control character returned  by  GetIn
  68.                             if  a  control  key  is  pressed while GetIn is
  69.                             executing.  The  following  function  keys  are
  70.                             defined global in the input unit:
  71.  
  72.                             NULL    = #00;            CsrDn   = #80;
  73.                             Beep    = #07;            CsrRt   = #77;
  74.                             PgUp    = #73;            CsrLt   = #75;
  75.                             PgDn    = #81;            Home    = #71;
  76.                             CsrUp   = #72;            Esc     = #27;
  77.                             CarriageReturn = #13;
  78.                             F1 = #59;  F2 = #60;  F3 = #61;  F4 = #62;
  79.                             F5 = #63;  F6 = #64;  F7 = #65;  F8 = #66;
  80.                             F9 = #67; F10 = #68;
  81.  
  82.                             Thus whether the F1 key has been pressed may be
  83.                             checked by simply saying "if Control = F1  then
  84.                             . . . ."
  85.  
  86.                    Number = The  numeric  representation of Indata if Numin
  87.                             is True.
  88.  
  89.  
  90.           There is one other global variable that may be of interest.  That
  91.     is the variable CsrLocation.  This variable  is  the  location  of  the
  92.     cursor  within the input field (0 to Maxin).  If you want the cursor to
  93.     start at the first character of the input field then set CsrLocation to
  94.     zero:
  95.  
  96.                           CsrLocation := 0;
  97.  
  98.           The GetIn procedure is set up so it will halt the program if  the
  99.     Ctrl  and End keys are pressed together.  Use this key combination with
  100.     care since GetIn does not clean up any open files  before  halting  the
  101.     program.
  102.  
  103.